﻿@{
    ViewBag.Title = "MaterialOut";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<style>
    .sub_nav li a {
        width: 100px;
    }
</style>
<div class="mod_containter" style="height: 100%" id="idmod_containter">
    <div class="main" id="idmain">
        <div class="mod_load" id="mod_load">
            <div class="mod_hd" id="idmod_hd">
                <h2 class="title">报表管理</h2>
                <div style="float:right">
                    <a class="white" id="aLoginOut">退出登录</a>
                    &nbsp;&nbsp;
                    <script type="text/javascript">

                        $("#aLoginOut").click(function () {
                            top.window.location.href = "/";

                        }).mouseover(function () {

                            $("#aLoginOut").toggleClass("red");
                        });

                    </script>
                    <style>
                        .red {
                            color: red;
                            font-size: 14px;
                            cursor: pointer;
                        }

                        .white {
                            color: white;
                            font-size: 14px;
                            cursor: pointer;
                        }
                    </style>
                </div>
            </div>
            <div class="mod_bd">
                <div class="sub_nav" id="sub_nav">
                    <ul>
                        <li><a href="/Report/MaterialIn">入库信息</a></li>
                        <li class="on"><a href="/Report/MaterialOut">出库信息</a></li>
                    </ul>
                </div>
                <div class="func_box" id="divBox">
                    <div class="inpt_box"> <input id="txtSearchContains" type="text" placeholder="请输入物料规格/物料类型/物料编码/产品编号" /> </div>
                    <div class="btn_box"> <button id="btnSearch" class="btn_green_m" data-type="reload"><i class="ico ico_bsearch"></i>搜索</button> </div>
                </div>
                <table id="infoList" style="width: auto; position: fixed; bottom:20px;"></table>

            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        var height = $(window).height();;
        var idmod_hd = $("#idmod_hd").height();
        var sub_nav = $("#sub_nav").height();
        var divBox = $("#divBox").height();

        var content = parseFloat(height) - parseFloat(idmod_hd) - parseFloat(sub_nav) - parseFloat(divBox) - 120;
        $("#infoList").css("height", content);
    });
</script>

<script>

    ////easyuui

    $(function () {

        $("#infoList").datagrid({
            url: '/Report/MaterialOutDetail',
            loadMsg: '数据加载中请稍后……',
            pagination: true,
            rownumbers: true,
            idField: "ID",
            nowrap: false,
            fitColumns: true,
            columns: [[
            {
                field: 'opeaOUT_TYPE', title: '出库类型', width: "6%", fixed: 'right', align: 'center', formatter: function (value, row, index) {
                    return OUT_TYPE(row.OUT_TYPE);
                }
            }
         , { field: 'M_CODE', title: '物料编码', width: "10%", align: "center" }
         , { field: 'M_TYPE', title: '物料类型', width: "8%", align: "center" }
        , { field: 'M_SPECIFICATION', title: '物料规格', width: "18%", align: "center" }
        , { field: 'NUMBER', title: '出库数量', width: "6%", align: "center" }
        , { field: 'PRODUCT_NAME', title: '产品名称', width: "10%", align: "center" }
        , { field: 'PRODUCT_NO', title: '产品编号', width: "12%", align: "center" }
        , { field: 'CAB_NAME', title: '柜号', width: "7%", align: "center" }
        , { field: 'PROCESS_TIME', title: '出库时间', width: "14%", align: "center" }
        , { field: 'USERNAME', title: '领料人', width: "10%", align: "center" }
            ]],
            singleSelect: true,
            pageSize: 100,
            pageList: [20, 50, 100]
        });
    });

    $("#btnSearch").click(function () {
        var target = $("#infoList")[0];
        state = $.data(target, "datagrid");
        opts = state.options;
        opts.queryParams.SearchContains = $("#txtSearchContains").val();
        $("#infoList").datagrid("load", opts.queryParams);
    });

    function OUT_TYPE(flag) {
        value = "";
        switch (flag) {
            case 0: value = "售卖"; break;
            case 1: value = "借还"; break;
            case 2: value = "回收"; break;
            default: value = ""; break;
        }
        return value;
    }
</script>
